#ifndef _OBJECT_MAP_H
#define _OBJECT_MAP_H

#include "header_obj.h"

#define MAP_LOAD_PERCENT 0.8

typedef struct 
{
    Value key;
    Value value;
} Entry; // key value对儿

typedef struct 
{
    ObjHeader obj_header;
    uint32_t count;
    uint32_t capacity; // map的容量
    Entry *entries; // Entry数组
} ObjMap;

ObjMap* new_objMap(VM *vm);

void map_set(VM *vm, ObjMap *obj_map, Value key, Value value);
Value map_get( ObjMap *obj_map, Value key);
void clear_map(VM *vm, ObjMap *obj_map);
Value remove_key(VM *vm, ObjMap *obj_map, Value key);

#endif